<%@page import="cn.egame.common.util.Utils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="cn.egame.ext.op.OperationActivityInfo"%>
<%@page import="cn.egame.ext.EnumTypeExt.OperationActivityRecordType"%>
<%@page import="cn.egame.ext.EnumTypeExt.OperationActivityPosition"%>
<%@page import="cn.egame.interfaces.fl.FileUsedType"%> 
<%@page import="com.egame.manage.biz.utils.ConstVar"%>
<%@page import="cn.egame.ext.op.AdvDetail"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<% 
	String urlString = request.getContextPath() + "/store/quick/advertise/set/edit.do"; 
%>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/main.css"  />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/ajaxfileupload.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		if($("#advType").val()!=""||$("#advType").val()!=null){
			var type = $("#advType").val();
			$("#AdvlinkUrl").val(type);
		}
		
		$("#AdvlinkUrl").change(function(){
			if($("#AdvlinkUrl").val()!=0) {
				var manu = $("#AdvlinkUrl").val();
				$("#advType").attr("value",manu);
			}
		});
	});

	function formSubmit(){
		var td = $("#form1").find("td[name='notnone']");
		var isSubmit = true;
		for(var i = 0; i<td.length; i++){
			if($(td[i]).find("input[type='text']").val() == "" || ($(td[i]).find("select")[0] && $(td[i]).find("option:selected").val() == 0)||($(td[i]).find("input[type='hidden']").val() == "")){
				$(td[i]).find("span").remove();
				$(td[i]).append("<span class='page_tip'>*必填</span>");
				isSubmit = false;
				return;
			}else{
				$(td[i]).find("span").remove();
			}
		}
		
		if(isSubmit){
			document.getElementById("form1").submit();
		}else{
			return;
		}
	}
</script>
<title>活动编辑页面</title>
</head>
<body>
<div class="matter_box">
	<div class="mt10 pt10 clearfix">
<form action=<%=urlString %> method="post" enctype="multipart/form-data" id="form1">	
		<table class="table2">
		<%
			if(request.getAttribute("bean")!=null){
				AdvDetail bean = (AdvDetail)request.getAttribute("bean");			
		%>
			<tr>
				<td>标题</td>
				<td name="notnone">
					<input type="hidden" name="advType" id="advType" value=<%=bean.getAdvType()%>>
					<input type="hidden" name="recordType" value=<%=bean.getRecordType()%>>
					<input type="hidden" name="status" value=<%=bean.getStatus()%>>
					<input type=hidden name=id value=<%=bean.getId() %> > 
					<input type=text name=title value=<%=bean.getTitle() %>>
				</td>
			</tr>
			<tr>
				<td>开始时间</td>
				<td name="notnone">
				<% 
					String time = "";
					if(bean.getBeginTime() != null){
						time = Utils.toDateString(bean.getBeginTime(),"yyyy-MM-dd hh:mm:ss");
					}					
				%>
					<input type=text name=beginString onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" value="<%=time %>"></td>
			</tr>
			<tr>
				<td>结束时间</td>
				<td name="notnone">
				<% 
				String endtime = "";
				if(bean.getEndTime() != null){
					endtime = Utils.toDateString(bean.getEndTime(),"yyyy-MM-dd HH:mm:ss");
				}	
				%>
					<input type=text name=endString onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" value="<%=endtime %>"></td>
			</tr>
			<tr>
				<td><label id=linklabel>链接地址</label></td>
				<td name="notnone">
					<select name=AdvlinkUrl id="AdvlinkUrl">
						<option value="1">应用ID</option>
						<option value="2">专题列表</option>
						<option value="3">装机必备列表</option>
						<option value="4">WAP地址</option>
					</select>
					<input type=text name=linkUrl value=<%=bean.getLinkUrl() %>>
				</td>
			</tr>			
			<tr>
				<td colspan="2"><input type="button" value="提交" class="btn3" onclick="formSubmit()"></td>
			</tr>
		<%
			}
		%>
		</table>
	</form>
</div>
</div>
</body>
</html>